/*
 * @Author: xuchao 
 * @Date: 2018-05-16 14:30:14 
 * @Last Modified by: xuchao
 * @Last Modified time: 2018-06-12 16:41:26
 */
import React, { Component } from 'react';
import { NavLink, withRouter } from 'react-router-dom';
import { Layout } from 'antd';
import { NavList } from './nav';

class ManagementNav extends Component {
    renderMenu=({ path, name })=>{
        const { pathname } = this.props.location;
        return (
            <li key={ path } className={ pathname === path ? 'active': '' }>
                <NavLink to={ path }>{ name }</NavLink>
            </li>    
        )
    }

    render(){
        return (
            <Layout.Sider width={200}>
                <ul>
                    {
                        NavList && NavList.map(
                            nav => this.renderMenu(nav)
                        )
                    }
                </ul>
            </Layout.Sider>
        )
    }
}

export default withRouter(ManagementNav);